#include <signal.h>
#include <stdio.h>

void handle_int(int sig);
int main(int argc, char const *argv[]) {
    struct sigaction sa_struct;
    sa_struct.sa_flags = SA_RESTART;
    sa_struct.sa_handler = handle_int;    
    sigaction(SIGINT, &sa_struct, NULL);
    printf("processed!\n");
    sleep(10);
    printf("end\n");
    return 0;
}

void handle_int(int sig) {
    if (sig == SIGINT) {
        printf("handle SIGINT\n");
    }
}
